/**
 *  Copyright 2011 Marco Berri - marcoberri@gmail.com
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
 **/
package com.mbfasttrack.model;

import java.util.ArrayList;
import java.util.List;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * @author Marco Berri marcoberri@gmail.com http://tecnicume.blogspot.com
 */
@Document
public class Tag implements Base {

    @Id
    @Indexed(unique = true)
    private String id;
    @Indexed(unique = true)
    private String slug;
    private String name;
    private Integer peso;
    @DBRef
    private List<Base> objects = new ArrayList();

    

    /**
     * 
     * @return
     */
    public String toString() {
        return "[" +
                " id:" + this.id + 
                " slug:" + this.slug + 
                " name:" + this.name + 
                " peso:" + this.peso + 
                " objects:" + this.objects + 
                "]"
                ;
    }
    
    
    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @return the slug
     */
    public String getSlug() {
        return slug;
    }

    /**
     * @param slug the slug to set
     */
    public void setSlug(String slug) {
        this.slug = slug;
    }

    /**
     * @return the objects
     */
    public List<Base> getObjects() {
        return objects;
    }

    /**
     * @param Object 
     */
    public void addObject(Base Object) {
        if (this.objects == null) {
            this.objects = new ArrayList();
        }
        this.objects.add(Object);

    }

    /**
     * @param objects the objects to set
     */
    public void setObjects(List<Base> objects) {
        this.objects = objects;
    }


    public String getName() {
        return name;
    }

    /**
     * @param name 
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the peso
     */
    public Integer getPeso() {
        return peso;
    }

    /**
     * @param peso the peso to set
     */
    public void setPeso(Integer peso) {
        this.peso = peso;
    }
}
